package org.example;

public class Student implements Comparable<Student>{
    private String name;

    private int sum;

    private String test() {
        System.out.println("测试封装方法");
        return "方法启动成功";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

    @Override
    public int compareTo(Student o) {
        if (this.getSum() > o.getSum())
        return -1;
        else if (this.getSum() < o.getSum())
            return  1;
        else
            return 0;
    }
}
